package org.ecpkn.PAGridSim.core.tasksCreation;

import java.util.Comparator;



public class ComparatorArriveTime implements Comparator<Job>{
	public int compare(Job job0, Job job1) {

		// arriveTime first,then periode
		int flagArriveTime = 0;
		double at0 = job0.getArriveTime_();
		double at1 = job1.getArriveTime_();
		flagArriveTime = (int) (at0-at1);
		if (flagArriveTime == 0) {
			int flagP = 0;
			double p0 = job0.getPeriode_();
			double p1 = job1.getPeriode_();
			flagP =(int) (p0-p1);
			return flagP;
		} else {
			return flagArriveTime;
		}
	}
}
